{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "63e9bc6e",
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "\n",
    "path = \"/gemini/platform/public/datasets/wudao_test/wiki_demo.txt\"\n",
    "output_path = \"/gemini/platform/public/datasets/wudao_test/wiki_demo.json\"\n",
    "\n",
    "all_dicts = []\n",
    "with open(path, \"r\") as f:\n",
    "    all_lines = f.readlines()\n",
    "    for line in all_lines:\n",
    "        all_dicts.append({\n",
    "            \"instruction\": \"\",\n",
    "            \"input\": \"\",\n",
    "            \"content\": line\n",
    "        })\n",
    "        \n",
    "with open(output_path,'w',encoding='utf-8') as file_obj:\n",
    "    json.dump(all_dicts,file_obj,ensure_ascii=False, indent=4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "92139474",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
